home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 7 / Apprentice-Release7.iso / Source Code / C / Applications / Moscow ML 1.42 / ANSIshellƒ / os_mac_eEdit.h < prev    next >
Encoding:
C/C++ Source or Header  |  1997-05-18  |  6.1 KB  |  202 lines  |  [TEXT/R*ch]

  1. /* eEdit.h     */
  2. /* 14Apr92  e  */
  3. /* 28Sep92  e  added print stuff */
  4.  
  5. #include <Types.h>
  6. #ifdef THINK_C
  7. #include <THINK.h>
  8. #endif
  9. #include <Memory.h>
  10. #include <Quickdraw.h>
  11. #include <Fonts.h>
  12. #include <Controls.h>
  13. #include <Windows.h>
  14. #include <Events.h>
  15. #include <Scrap.h>
  16. #include <TextEdit.h>
  17. #include <ToolUtils.h>
  18. #include <Errors.h>
  19. #include <Printing.h>
  20. #include <Menus.h>
  21.  
  22. #define CONTEXT_LINES         3            /* lines to show around caret for eTeShowCaret() */
  23.  
  24. #define    PAGE_DELAY            1
  25.  
  26. #define MIN_RUNS            (10)        /* # runs to extend the run starts block */
  27. #define MIN_LINES            (100)        /* # lines to extend the line starts block */
  28. /* 28May92  e  was:
  29. #define MAX_SCROLL_CHARS    (1024)        /* max # of chars to scroll horizontally */
  30.  
  31. /*
  32.  * ASCII character definitions
  33.  */
  34. #define ENTER            0x03            /* keypad ENTER */
  35. #define DELETE            0x08            /* delete/backspace key */
  36. #define TAB                0x09            /* normal TAB    - stored in text */
  37. #define RETURN            0x0D            /* normal RETURN - stored in text */
  38. #define SPACE            0x20
  39.  
  40. /*
  41.  * ARROW key definitions - uses ASCII codes, not keycodes.
  42.  */
  43. #define LEFT_ARROW        0x1C
  44. #define RIGHT_ARROW        0x1D
  45. #define UP_ARROW        0x1E
  46. #define DOWN_ARROW        0x1F
  47.  
  48. /*
  49.  * KEYCODE definitions for function keys on extended keyboard
  50.  */
  51. #define KeyF1            0x7A
  52. #define KeyF2            0x78
  53. #define KeyF3            0x63
  54. #define KeyF4            0x76
  55. #define KeyF5            0x60
  56. #define KeyF6            0x61
  57. #define KeyF7            0x62
  58. #define KeyF8            0x64
  59. #define KeyF9            0x65
  60. #define KeyF10            0x6D
  61. #define KeyF11            0x67
  62. #define KeyF12            0x6F
  63. #define KeyF13            0x69
  64. #define KeyF14            0x6B
  65. #define KeyF15            0x71
  66.  
  67. #define KeyHelp            0x72
  68. #define KeyHome            0x73
  69. #define KeyPageUp        0x74
  70. #define KeyDel            0x75
  71. #define KeyEnd            0x77
  72. #define KeyPageDown        0x79
  73.  
  74. /*  8Jul92  e   for: curStyle  */
  75. #define NOSTYLE (-1)
  76.  
  77. typedef long LineRec;
  78.  
  79. typedef long RunRec;
  80.  
  81. struct ChPos {
  82.     short v;
  83.     short h;
  84. };
  85. typedef struct ChPos ChPos;
  86.  
  87. typedef struct eRec
  88. {    Rect         viewRect;
  89.     Rect         caretRect;
  90.     ChPos         bounds;
  91.     ChPos         position;
  92.     ChPos         caretChPos;
  93.     ChPos         selStart;
  94.     ChPos         selEnd;
  95.     ChPos         writeChPos;        /* chpos for writer (vs. human editor) 8Jul92  e  */
  96.     Boolean     selActive;
  97.     Boolean     caretState;
  98.     Boolean     active;
  99.     Boolean     dirty;
  100.     short         leftMargin;
  101.     short         topMargin;
  102.     short         hContext;        /* #chars/#lines visible around caret in eTeShowCaret() */
  103.     short         vContext;
  104.     short         hOverlap;        /* #chars/#lines visible between one page scroll & the next */
  105.     short         vOverlap;
  106.     short         hStep;            /* #chars/#lines to step for scroll arrow */
  107.     short         vStep;
  108.     short         wrap;            /*              5Jul92  for line wrap, max chars/line */
  109.     short        tabStops;        /*              8Jul92  measured in spaces */
  110.     short        autoInd;        /*                25Jan93  auto indent flag   */
  111.     short        spare;
  112.     short        hSpan;            /* computed */
  113.     short        vSpan;
  114.     short         hScale;            /* computed - pixels per scroll unit */
  115.     short         vScale;
  116.     long         hOrigin;        /* computed */
  117.     long         vOrigin;
  118.     short         width;            /* computed */
  119.     short         height;
  120.     short         caretHeight;    /* computed */
  121.     short         fontAscent;
  122.     short         tabWidth;        /* computed     8Jul92  renamed */
  123.     short         spaceWidth;
  124.     short         maxRight;        /* computed */
  125.     short         qRuns;
  126.     short         linesAllocated;    /* computed */
  127.     short         runsAllocated;
  128.     short         curStyle;        /* computed     8Jul92  to speed up drawing */
  129.     short        fustStyle;
  130.     TextStyle    style[2];        /* use eTeSetStyles() */
  131.     ProcPtr     eTeWordBreak;    /* use eTeWordBreak() */
  132.     WindowPtr     macPort;        /* use eTeNew() */
  133.     ControlHandle hSBar;        /* use eTeNew() */
  134.     ControlHandle vSBar;        /* use eTeNew() */
  135.     Handle         hText;            /* use eTeNew() or eTeSetTextHandle() */
  136.     LineRec     **hLines;        /* computed */
  137.     long         **hRuns;        /* computed */
  138.     THPrint        hPrint;            /* Handle to print record for file       28Sep92  e  */
  139. } eRec, **eTeHandle;
  140.  
  141. OSErr    eTePrint( eRec **hE, Boolean jobDlg, Boolean firstJob, Str255 flnm);    /*   28Sep92  e  */
  142.  
  143. ChPos     eTeOffsetToChPos( eRec **hE, register long anOffset );
  144. long     eTeChPosToOffset( eRec **hE, ChPos aPos );
  145. long     eTeTextLength( eRec **hE );
  146.  
  147. void     eTeGetRun( eRec **hE, long *sta, long *end );
  148.  
  149. void     eTeScroll( eRec **hE, short hDelta, short vDelta, Boolean redraw );
  150. void     eTeScrollTo( eRec **hE, ChPos aPosition, Boolean redraw );
  151. void     eTeShowCaret( eRec **hE );
  152.  
  153. void     eTeSetWrap( eRec **hE, short wrap );
  154. void     eTeSetTabStop( eRec **hE, short aTabStop );
  155. void     eTeSetWordBreak( eRec **hE, ProcPtr aFunc );
  156.  
  157. void     eTePutScrap();                                  /*  13Aug92  e  */
  158. void     eTeGetScrap();                                  /*  13Aug92  e  */
  159. void    eTeUndo( eRec **hE );                           /*  13Aug92  e  */
  160. void    eTeEditMenuUpdate( eRec **hE, MenuHandle hM );    /*  13Aug92  e  */
  161.  
  162. void     eTeIdle( eRec **hE );
  163. void     eTeActivate( eRec **hE );
  164. void     eTeDeactivate( eRec **hE );
  165. void     eTeDraw( eRec **hE, Rect *area );
  166. void     eTeUpdate( eRec **hE );
  167. void     eTeClick( eRec **hE, Point hitPt, short modifierKeys, long when );
  168. void     eTeCut( eRec **hE );
  169. void     eTeCopy( eRec **hE );
  170. void     eTeDelete( eRec **hE );
  171. void     eTeKillTo( eRec **hE, ChPos chPos );  /* 12Jul92  e */
  172. void     eTePaste( eRec **hE, short style );
  173. void     eTeInsert( eRec **hE, Ptr textPtr, long numChars, short style );
  174. void     eTeWrite(  eRec **hE, Ptr textPtr, long numChars, short style );      /*  9Jul92  e */
  175. void     eTeTranspose( eRec **hE, long beg, long midl, long midr, long end ); /* 22Jul92  e */
  176. void     eTeKey( eRec **hE, char theChar, Byte keyCode, short modifiers, short style );
  177. void     eTeSetSelect( eRec **hE, long aStart, long anEnd );
  178.  
  179. short     eTeSetTextPtr( eRec** hE, Ptr pT, long numChars );
  180. short     eTeSetTextHandle( eRec** hE, Handle hT );
  181. short     eTeSetTextHandleDetabify( eRec **hE, Handle hT, short tabstops );
  182.  
  183. void     eTeNewView( eRec **hE, Rect *view );
  184. void     eTeSetStyles( eRec **hE, TextStyle *ts0, TextStyle *ts1 );
  185.  
  186. void     eTeInit( void );
  187. eRec  **eTeNew( WindowPtr macPort, Rect viewRect, short tabStops, short wrap,
  188.                  short autoInd, ControlHandle aHSizing, ControlHandle aVSizing );
  189. void     eTeDispose( eRec **hE );
  190.  
  191. extern EventRecord        gLastMouseUp;
  192. extern EventRecord        gLastMouseDown;
  193. extern long                gMaxSleep;
  194.  
  195. OSErr    PageSetupDialog( eRec **hE );
  196.  
  197. // 18May1997 added these prototypes
  198. short DeTabifyHandle( Handle h, long *size, long *count, short tabstop );
  199. void eTeDrawLine( eRec **hE, ChPos beginPos, Point location );
  200.  
  201. /* end of eEdit.h */
  202.